package cn.tlb.ui.widget;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.ClipboardManager;
import android.view.View;

import cn.tlb.xutilsdownload.R;

public class DialogDemoActivity extends AppCompatActivity {

    private static final String DIALOG_MESSAGE = "dialog message";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialog_demo);
    }

    public void test01(View view) {
        new AlertDialog.Builder(DialogDemoActivity.this)
                .setTitle("Oh nose everything broke")
                .setMessage(DIALOG_MESSAGE)
                .setPositiveButton(android.R.string.ok, null)
                .setNeutralButton(android.R.string.copy,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface aDialog, int button) {
                                ClipboardManager mgr = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                                mgr.setText(DIALOG_MESSAGE);
                            }
                        }).

                show();
    }
}
